<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>课程</title>
</head>

<body>
<div th:fragment="nav">
    <!-- 导航栏-->
    <div style="border:2px slateblue solid">
        <h2 align="center">基于SpringBoot2.7.x MyBatis2.3.x Thymeleaf 的学生成绩简易系统-Mark5</h2>
        <hr>
        <div style="display: flex; justify-content: space-between">
            <h4><a href="/mark5/go2login">学生成绩简易系统-首页</a></h4>
            <div  style="width: 50%; display: flex;  align-content: right;  justify-content: space-between; padding-top: 12px">
                <p th:if="${ session.user== null}" style="color: #aabec5">
                    未登录</p>
                <p  th:if="${ session.user!= null}"style="color: orangered">
                    已登录</p>
                <p style="color: blue" >姓名:
                    <span th:if="${session.user!=null}" th:text="${session.user.uname}"></span></p>
                <p style="color: blueviolet">角色:<span th:if="${session.user!=null}" th:text="${session.user.role}"></span></p>

            </div>
            <p style="color: blue"><a href="/mark5/logout.do">退出</a></p>
            <div th:if="${session.user!= null}" style="width: 5vw; height: 5vw">
                <img style="height: 90%; width: 100% " th:src="'/mark5/showimg/'+ ${session.user.pic}"/>
            </div>
            <p>&nbsp;</p>
        </div>
    </div>
    <!--<hr>-->
</div>



<div th:if="${session.user!=null &&session.user.role=='adm'}">
<h1 style="display: flex; justify-content: space-around" >课程管理</h1>
<!--<a th:text="${clz}"></a>-->
<hr>
<div style="display: flex;justify-content: space-around">


<div >

    <!--           分页表单          -->
    <table  width="120%" border="1" cellspacing="0" style="line-height: 36px">
       <tr>
           <td align="center">课程编号</td>
           <td align="center">课程名</td>
           <td colspan="2" align="center">功能</td>
           <!--align="center" 水平居中-->
       </tr>
    <tr th:each="x:${courses}">
        <td th:text="${x.cno}"></td>
        <td th:text="${x.cname}"></td>
        <td> <a th:href="'/course/go2update?cno='+${x.cno}">修改</a> </td>
        <td> <a th:href="'/course/del?cno='+${x.cno}">删除</a> </td>
    </tr>
</table>
    <!--<a>每页固定6行即可</a>-->
    <!--                       功能                              -->
     <a th:href="'/course/prevpage?curpage='+${curpage}">上一页</a>
    <a th:text="(${curpage})"></a> /
    <a th:text="${curpagemax}"></a>
    <a th:href="'/course/nextpage?curpage='+${curpage}">下一页</a>
</div>

<div>

        <h3><a href="/course/go2add"> 添加一个新的课程</a></h3>

    <h2>添加与修改</h2>
    <form  th:action="'/course/'+${action}+'?curpage='+${curpage}" method="post">
    clzno:<input type="text" name="cno" th:value="${cno}"><br>
    clzname:<input type="text" name="cname" th:value="${cname}"><br>

        <div th:if="${action}=='add'">
            <input type="submit" th:value="添加">
        </div>
        <div th:if="${action}=='update'">
            <input type="submit" th:value="修改">
        </div>
    </form>
</div>
</div>
</div>
</body>
</html>